package com.corona.game;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Vector3;
import com.corona.Game;
import com.corona.game.action.DrawAction;
import com.corona.game.util.GameProfiler;
import com.corona.game.util.TextureCache;
import java.util.Iterator;

/* compiled from: PkmnMap.java */
/* loaded from: pokewilds.jar:com/pkmngen/game/DrawMapGrass.class */
public class DrawMapGrass extends DrawAction {
    Sprite blankSprite;
    Pixmap pixels;
    Texture texture;
    Vector3 startPos;
    Vector3 endPos;
    public static Sprite tidalSprite = new Sprite(TextureCache.get(Gdx.files.internal("tiles/water2.png")), 0, 0, 16, 16);
    Tile tile;
    Tile exteriorTile;
    public Action.Layer layer = Action.Layer.map_120;
    Color prevColor = new Color();
    Sprite fossilSprite = new Sprite(TextureCache.get(Gdx.files.internal("tiles/fossil1.png")), 0, 0, 16, 16);

    public DrawMapGrass(GameProfiler profiler) {
        super(profiler);
    }

    @Override // com.corona.game.Action
    public Action.Layer getLayer() {
        return this.layer;
    }

    @Override // com.corona.game.action.DrawAction
    protected void draw(Game game) {
        if (!game.player.dontDrawMapDuringBattle) {
            Iterator<Tile> it = game.map.onscreenGrass.iterator();
            while (it.hasNext()) {
                Tile tile = it.next();
                game.mapBatch.draw(tile.overSprite, tile.sprite.getX(), tile.sprite.getY());
            }
            this.prevColor.set(game.mapBatch.getColor());
            game.mapBatch.setColor(this.prevColor.r, this.prevColor.g, this.prevColor.b, 0.5f);
            Iterator<Tile> it2 = game.map.onscreenExteriorTidal.iterator();
            while (it2.hasNext()) {
                Tile tile2 = it2.next();
                game.mapBatch.draw(tidalSprite, tile2.position.x, tile2.position.y);
            }
            game.mapBatch.setColor(this.prevColor);
            Iterator<Tile> it3 = game.map.onscreenFossils.iterator();
            while (it3.hasNext()) {
                Tile tile3 = it3.next();
                if (tile3.hasItem != null) {
                    if (tile3.hasItem.contains("fossil") || tile3.hasItem.equals("old amber")) {
                        if (tile3.hasItem.equals("helix fossil")) {
                            this.fossilSprite.setRegion(0, 16, 16, 16);
                        } else if (tile3.hasItem.equals("dome fossil")) {
                            this.fossilSprite.setRegion(0, 32, 16, 16);
                        } else if (tile3.hasItem.equals("old amber")) {
                            this.fossilSprite.setRegion(0, 0, 16, 16);
                        } else if (tile3.hasItem.equals("root fossil")) {
                            this.fossilSprite.setRegion(0, 48, 16, 16);
                        } else if (tile3.hasItem.equals("claw fossil")) {
                            this.fossilSprite.setRegion(0, 64, 16, 16);
                        } else if (tile3.hasItem.equals("shield fossil")) {
                            this.fossilSprite.setRegion(0, 80, 16, 16);
                        } else if (tile3.hasItem.equals("skull fossil")) {
                            this.fossilSprite.setRegion(0, 96, 16, 16);
                        }
                        game.mapBatch.draw(this.fossilSprite, tile3.position.x, tile3.position.y);
                    } else if (!tile3.isSign() && !tile3.hasItem.equals("secret key") && !tile3.hasItem.equals("poké ball")) {
                        game.mapBatch.draw(TextureCache.get(Gdx.files.internal("tiles/pokeball1.png")), tile3.position.x, tile3.position.y);
                    }
                }
            }
            Iterator<Pokemon> it4 = game.map.onscreenBurrowed.iterator();
            while (it4.hasNext()) {
                Pokemon pokemon = it4.next();
                if (pokemon.drawUpper != null) {
                    pokemon.drawUpper.draw(game);
                }
            }
        }
    }
}
